package com.cndongtai.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.cndongtai.dao.BaseDao;
import com.cndongtai.dao.inter.MenuMapper;
import com.cndongtai.po.Menu;

@Repository("menuDao")
public class MenuDao extends BaseDao implements MenuMapper {

	@Override
	public List<Menu> queryMenuList(Long roleId) {
		SqlSession sqlSession = getSqlSession();
		try {
			MenuMapper operation = sqlSession.getMapper(MenuMapper.class);
			return operation.queryMenuList(roleId);
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return null;
	}

	@Override
	public List<Menu> queryAllMenuList() {
		SqlSession sqlSession = getSqlSession();
		try {
			MenuMapper operation = sqlSession.getMapper(MenuMapper.class);
			return operation.queryAllMenuList();
		}catch(Exception e) {
			e.printStackTrace();
		}finally {
			sqlSession.close();
		}
		
		return null;
	}

}
